package com.instagram.instadownloader.history;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * The Class HistoryObject.
 */
public class HistoryObject {

	/** The m absolute path. */
	private String mAbsolutePath;
	
	/** The m contained folder. */
	private String mContainedFolder;
	
	/** The m file name. */
	private String mFileName;
	
	/** The m share instagram. */
	private String mShareInstagram;
	
	private String urlImage;
	
	

	public String getUrlImage() {
		return urlImage;
	}

	public void setUrlImage(String urlImage) {
		this.urlImage = urlImage;
	}

	/**
	 * Instantiates a new history object.
	 */
	public HistoryObject() {
	}

	/**
	 * Instantiates a new history object.
	 *
	 * @param absolutePath the absolute path
	 * @param shareInstaUrl the share insta url
	 */
	public HistoryObject(String absolutePath, String shareInstaUrl) {
		this.mAbsolutePath = absolutePath;
		this.mFileName = "";
		this.mContainedFolder = searchContainedFolderPath(absolutePath);
		this.mShareInstagram = shareInstaUrl;
	}
	public HistoryObject(String absolutePath, String shareInstaUrl, String urlImage) {
		this.mAbsolutePath = absolutePath;
		this.mFileName = "";
		this.mContainedFolder = searchContainedFolderPath(absolutePath);
		this.mShareInstagram = shareInstaUrl;
		this.urlImage = urlImage;
	}

	/**
	 * Gets the absolute path.
	 *
	 * @return the absolute path
	 */
	public String getAbsolutePath() {
		return this.mAbsolutePath;
	}

	/**
	 * Gets the contained folder.
	 *
	 * @return the contained folder
	 */
	public String getContainedFolder() {
		return this.mContainedFolder;
	}

	/**
	 * Gets the file name.
	 *
	 * @return the file name
	 */
	public String getFileName() {
		return this.mFileName;
	}

	/**
	 * Gets the share url.
	 *
	 * @return the share url
	 */
	public String getShareUrl() {
		return this.mShareInstagram;
	}

	/**
	 * Search contained folder path.
	 *
	 * @param absolutePath the absolute path
	 * @return the string
	 */
	public String searchContainedFolderPath(String absolutePath) {
		Matcher localMatcher = Pattern.compile("^(.*)/(.*).(.*)$").matcher(absolutePath);
		if (localMatcher.find()) {
			return localMatcher.group(1);
		}
		return "";
	}

	/**
	 * Sets the absolute path.
	 *
	 * @param paramString the new absolute path
	 */
	public void setAbsolutePath(String paramString) {
		this.mAbsolutePath = paramString;
	}

	/**
	 * Sets the contained folder.
	 *
	 * @param paramString the new contained folder
	 */
	public void setContainedFolder(String paramString) {
		this.mContainedFolder = paramString;
	}

	/**
	 * Sets the file name.
	 *
	 * @param paramString the new file name
	 */
	public void setFileName(String paramString) {
		this.mFileName = paramString;
	}

	/**
	 * Sets the share url.
	 *
	 * @param paramString the new share url
	 */
	public void setShareUrl(String paramString) {
		this.mShareInstagram = paramString;
	}

}
